import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeviceSystemVO, DeviceSystemForm, DeviceSystemQuery } from '@/api/workorder/deviceSystem/types';

/**
 * 查询设备系统列表
 * @param query
 * @returns {*}
 */

export const listDeviceSystem = (query?: DeviceSystemQuery): AxiosPromise<DeviceSystemVO[]> => {
  return request({
    url: '/workorder/deviceSystem/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备系统详细
 * @param id
 */
export const getDeviceSystem = (id: string | number): AxiosPromise<DeviceSystemVO> => {
  return request({
    url: '/workorder/deviceSystem/' + id,
    method: 'get'
  });
};

/**
 * 新增设备系统
 * @param data
 */
export const addDeviceSystem = (data: DeviceSystemForm) => {
  return request({
    url: '/workorder/deviceSystem',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备系统
 * @param data
 */
export const updateDeviceSystem = (data: DeviceSystemForm) => {
  return request({
    url: '/workorder/deviceSystem',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备系统
 * @param id
 */
export const delDeviceSystem = (id: string | number | Array<string | number>) => {
  return request({
    url: '/workorder/deviceSystem/' + id,
    method: 'delete'
  });
};
